package com.zut.blocks.base.common.request;

import com.zut.blocks.base.common.CommonRequest;
import com.zut.blocks.base.domain.CourseGrade;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import org.springframework.data.domain.Example;
import org.springframework.data.domain.ExampleMatcher;

/**
 * @author lxd
 * @date 2020/12/6 21:43
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = true)
public class CourseGradeRequest extends CommonRequest {
    private Integer courseId;

    public Example<CourseGrade> example() {
        CourseGrade courseGrade = new CourseGrade();
        courseGrade.setCourseId(courseId);
        courseGrade.setCreateTime(null);

        return Example.of(courseGrade, ExampleMatcher
                .matching()
                .withMatcher("courseId", ExampleMatcher.GenericPropertyMatchers.exact())
        );
    }
}
